﻿


using Kstopa.Core.Helper;
using Kstopa.Domain;
using Kstopa.Sqlsugar.Abstractions;

namespace Kstopa.Sqlsugar.DataSeeds
{
    public class SysUsersDataSeed : IDataSeedContributor, ITransientDependency
    {
        private readonly ISqlSugarRepository<SysUser> _repository;

        public SysUsersDataSeed(ISqlSugarRepository<SysUser> repository)
        {
            _repository = repository;
        }
        public async Task SeedAsync(DataSeedContext _Db)
        {
            if (!await _repository.IsAnyAsync(x => true))
            {
                await _repository.InsertManyAsync(GetSeedData());
            }
        }

        private List<SysUser> GetSeedData()
        {
           List<SysUser> list=new List<SysUser>()
           {
               new SysUser
               {
                 Account="superAdmin",Password=MD5Helper.MD5Encrypt32("123456"),CreateTime=DateTime.Now,CreateUser="superAdmin"
               }
           };
            return list;
        }
    }
}
